package org.example.afree;

public class The_length_of_the_last_word {

    public int lengthOfLastWord(String s) {
        String[] strings = s.split(" ");
        for (int i = strings.length-1; i >= 0; i--) {
            if (!strings[i].equals(" ")){
                return strings[i].length();
            }
        }
        return 0;
    }
}
